package Comprehensive_03;

import java.util.HashMap;
import java.util.Set;

public class Demo7 {
    /*
        某学校Java学科分为基础班和就业班:
        Java基础班:
          001	李晨
          002	范冰冰
        Java就业班:
          001	马云
          002	马化腾
        使用HashMap嵌套HashMap方式完成存储数据,并遍历出所有的学生
     */
    public static void main(String[] args) {
        HashMap<String, HashMap<String, String>> hm = new HashMap<>();
        HashMap<String,String> stu1 = new HashMap<>();
        stu1.put("001","李晨");
        stu1.put("002","范冰冰");
        HashMap<String,String> stu2 = new HashMap<>();
        stu2.put("001","马云");
        stu2.put("002","马化腾");

        hm.put("Java基础班", stu1);
        hm.put("Java进阶班", stu2);

        Set<String> str = hm.keySet();
        for (String s : str) {
            System.out.println(s + ":");
            for (String s1 : hm.get(s).keySet()) {
                System.out.println("\t" + s1 + "\t" + hm.get(s).get(s1));
            }
        }
    }
}
